home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue52 / Alfresco / TstSpCkU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-10-31  |  1.2 KB  |  60 lines

  1. unit TstSpCkU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, AASplChk;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     Label1: TLabel;
  13.     ListBox1: TListBox;
  14.     Label2: TLabel;
  15.     Label3: TLabel;
  16.     Button1: TButton;
  17.     procedure Button1Click(Sender: TObject);
  18.     procedure FormCreate(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.     SpellChecker : TaaSpellChecker;
  24.   end;
  25.  
  26. var
  27.   Form1: TForm1;      
  28.  
  29. implementation
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TForm1.Button1Click(Sender: TObject);
  34. var
  35.   List : TStringList;
  36. begin
  37.   if SpellChecker.WordExists(Edit1.Text) then begin
  38.     Label2.Caption := Edit1.Text + ' exists.';
  39.     ListBox1.Items.Clear;
  40.   end
  41.   else begin
  42.     Label2.Caption := Edit1.Text + ' does not exist.';
  43.     List := TStringList.Create;
  44.     try
  45.       List.Sorted := true;
  46.       SpellChecker.GetAlternatives(Edit1.Text, List);
  47.       Listbox1.Items.Assign(List);
  48.     finally
  49.       List.Free;
  50.     end;
  51.   end;
  52. end;
  53.  
  54. procedure TForm1.FormCreate(Sender: TObject);
  55. begin
  56.   SpellChecker := TaaSpellChecker.Create('WORD.LST');
  57. end;
  58.  
  59. end.
  60.